﻿using System;
using System.Threading;
 
namespace Solidi
{
    sealed class LazyDependencyFactory<T> : GenericDependencyFactory
    {
		public override object Create(IDependencyContext context, IDependencyKey key)
        {
            GenericDependencyFactory factory = new FuncDependencyFactory<T>();

            return new Lazy<T>((Func<T>)factory.Create(context, key), LazyThreadSafetyMode.ExecutionAndPublication);
        }
    }
}